import json
from django.db import models

class StockPrice(models.Model):
  """Models an individual Guestbook entry with an author, content, and date."""
  Name = models.CharField(max_length=255)
  Date = models.DateTimeField('date')
  Open = models.FloatField()
  High = models.FloatField()
  Low = models.FloatField()
  Close = models.FloatField()
  Change = models.FloatField()
  PChange = models.FloatField('% Change')
  Vol = models.BigIntegerField()
  Val = models.BigIntegerField(null=True)
  Update = models.DateTimeField('date create',auto_now_add=True)    
    
  def __unicode__(self):
    return self.Name
  def getQuoteDict(self):
    #"date": self.Date.strftime("%Y-%m-%d"),
    return { "Quote": self.Name,
             "Date": self.Date,
             "Open": self.Open,
             "High": self.High,
             "Low": self.Low,
             "Close": self.Close,
             "Volume": self.Vol}  
